﻿using Axios.Engine;
using FarseerPhysics.Common;
using FarseerPhysics.Factories;
using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework;

namespace axios_tennis
{
    public class Border : SimpleAxiosGameObject
    {
        public Vertices VertexBorder;

        public Border()
        {

        }

        public Border(int width, int height)
        {
            float halfWidth = ConvertUnits.ToSimUnits(width) / 2f;
            float halfHeight = ConvertUnits.ToSimUnits(height) / 2f;

            VertexBorder = new Vertices(4);
            VertexBorder.Add(new Vector2(-halfWidth, halfHeight));
            VertexBorder.Add(new Vector2(halfWidth, halfHeight));
            VertexBorder.Add(new Vector2(halfWidth, -halfHeight));
            VertexBorder.Add(new Vector2(-halfWidth, -halfHeight));
        }

        public override void LoadContent(AxiosGameScreen gameScreen)
        {
            base.LoadContent(gameScreen);

            this.BodyPart = BodyFactory.CreateLoopShape(gameScreen.World, this.VertexBorder);
            this.SetCollideWithAll(BodyPart);
        }

    }
}
